//
//  MyEmotionPopView.m
//  WeChat
//
//  Created by Mac on 16/2/27.
//  Copyright © 2016年 Mac. All rights reserved.
//

#import "YJEmotionPopView.h"

@interface YJEmotionPopView()

@end
@implementation YJEmotionPopView

+ (instancetype)popView
{
    return  [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
}

-(void)showFrom:(YJEmotionBtn *)btn
{
    
    if (btn == nil)
        return;
    //将表情放入放大镜中
    self.emotionBtn.emotion = btn.emotion;
    
    UIWindow *win = [[UIApplication sharedApplication].windows lastObject];
    //转换坐标系
    CGRect convertFrame  = [btn convertRect:btn.bounds toView:win];
    //popView的位置
    self.centerX = btn.centerX;
    self.centerY = CGRectGetMidY(convertFrame) - self.height*0.5;

    [win addSubview:self];
    
}

@end
